<?php
session_start();
$_SESSION[uid]='2';

include_once '../../web_inc.php';
include_once ROOT_PATH.'/config/db_conn.php';
//include_once './inc/gy_info_class.php';
include_once './inc/subpage.class.php';  //分页函数
include_once './smarty_inc.php';
//include_once './check_login.php';   //用户登录验证文件，正式环境下必须开启！！！测试注释掉



/*
  ***
  ***第一步：：：：判断学校分类传值，值为用户所属学校，如果为空跳转回验证页面qzone/check.php
  ***
*/
if(!empty($_SESSION[uid])){
	$user_id=$_SESSION[uid];
}else{
	echo "<script>window.location.href='../../qzone/index.php';</script>";
}





/*
  ***
  ***第三步：：：：获取分类信息，列表，可以输出的表为：gylist   gylist_2   user   school
  ***
*/
$sql=mysql_query("select COUNT(id) as num from gylist where user_id=$user_id");   //正式环境为user_id=$_SESSION[name]
$info=mysql_fetch_array($sql);

//列表设置

$pid_totle=$info[num];
$page_size =2;  //每页显示的条数   
$nums = $pid_totle;   //总条数   
$sub_pages = $pid_totle/$page_size + 1;  //得到当前是第几页     
$pageCurrent=$_GET["p"];  //当前页数  
if(!$pageCurrent){
	$pageCurrent=1;//如果没设定页数默认是第一页 
}
 
$ww=($pageCurrent-1)*$page_size;


$qu=mysql_query("Select gy_class.id,gy_class.*,gylist.* from gylist INNER JOIN gy_class ON gylist.class_id=gy_class.id where gylist.user_id=$user_id order by gylist.time DESC  limit $ww,$page_size");

while($lin=mysql_fetch_array($qu)){
	$gy[]=array(
		            "title"=>$lin[title],
		            "id"=>$lin[id],
		            "class"=>$lin[name],
		           );

	$smarty->assign("lin",$gy);

}
$smarty->assign("ROOT",ROOT_PATH);
$smarty->display("member/mygy_list.htm");
$subPages=new SubPages($page_size,$nums,$pageCurrent,$sub_pages,"?action=setpage&p=",2);






?>